﻿@using CashOrCard.Helper
@model CashOrCard.Models.AdvtSite
<div id="site-detail">
    <div class="detail-left">
        <div class="site-title">
            <div class="title">@Html.DisplayFor(item => item.SiteName)</div>
            <div class="ratestar">@Html.Partial("_SiteRating", Model, new ViewDataDictionary { { "disabled", true }, { "showmsg", true } })</div>
            <div class="share">
                <div class="share-images">
                    <span>Share:</span>
                    <a href="#">
                        <img src="~/Images/detail-email-icon.gif" /></a>
                    <a href="#">
                        <img src="~/Images/detail-facebook-icon.gif" /></a>
                    <a href="#">
                        <img src="~/Images/detail-twitter-icon.gif" /></a>
                </div>
            </div>
        </div>
        <div class="site-images">
            <!--<div class="big-image"><img src="~/Images/site-image-1.gif" /></div>
            <div class="slide-images">
                <img src="~/Images/site-image-thumb-1.gif" />
                <img src="~/Images/site-image-thumb-1.gif" />
                <img src="~/Images/site-image-thumb-1.gif" />
                <img src="~/Images/site-image-thumb-1.gif" />
            </div>-->
            @if (Model.SiteImages.Count > 0)
            {
                <ul id="images-slide" class="jcarousel-skin-pika">
                    @foreach (CashOrCard.Models.AdvtSiteImage siteImage in Model.SiteImages)
                    {
                        <li><a class="SiteImage" href="@siteImage.Path">
                            <img src='@string.Format("{0}{1}.jpg", @siteImage.Path.Substring(0, @siteImage.Path.Length - 4).Trim(), "_thumb")' ref='@string.Format("{0}{1}.jpg", @siteImage.Path.Substring(0, @siteImage.Path.Length - 4).Trim(), "_medium")' /></a></li>
                    }
                </ul>
            }
        </div>
        <div class="detail-sections">
            <div class="buttons">
                <ul>
                    <li class="overview">Overview</li>
                    <li class="promotion">Promotion</li>
                    @if(Model.SiteAmount >= Common.SiteVisitChargeAmount && !string.IsNullOrEmpty(Model.SiteURL))
                    {
                        <li class="visitsite" onclick="visitsite('@Model.AdvtSiteId')">Visit Website</li>
                    }
                </ul>
            </div>
            <div class="section-content" id="overview">
                <div class="basic-info">
                    <ul class="basicitem">
                        <li class="address">
                            <div class="title">Address:</div>
                            <div class="content">@Html.DisplayFor(x => x.Address)</div>
                        </li>
                        <li class="phone">
                            <div class="title">Phone:</div>
                            <div class="content">@Html.DisplayFor(x => x.PhoneNumber)</div>
                        </li>
                        <li class="cards">
                            <div class="title">Cards Accepted:</div>
                            <div class="content cards">
                                <div class="cards-image">
                                    @foreach (var cardItem in Model.CardTypes)
                                    {
                                        <img src="@cardItem.ThumbPath" />
                                    }
                                </div>
                            </div>
                        </li>
                        <li class="cash">
                            <div class="title">Cash Accepted:</div>
                            <div class="content">
                                @foreach (var cashItem in Model.CashTypes)
                                {
                                    <span>@cashItem.CashTypeName</span>
                                }
                            </div>
                        </li>
                    </ul>                    
                    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
                    <script type="text/javascript">
                        function initialize() {
                            var latlngPos = new google.maps.LatLng(@Model.latitude,@Model.longitude);
                            var mapOptions = {
                                center: latlngPos,
                                zoom: 12,
                                mapTypeId: google.maps.MapTypeId.ROADMAP
                            };
                            var map = new google.maps.Map(document.getElementById('map-canvas'),
                                mapOptions);

                            var marker = new google.maps.Marker({
                                position: latlngPos,
                                map: map,
                                title: "@Model.SiteName"
                           });
                        }
                        google.maps.event.addDomListener(window, 'load', initialize);
                    </script>
                    <div class="map">
                        <div id="map-canvas">
                        </div>
                        @*<img src="~/Images/map-1.gif" />*@
                    </div>
                </div>
                <div class="descrition">
                    @Html.DisplayFor(x => x.SiteDescription)
                </div>
            </div>
            <div class="section-content" id="promotion">
                @foreach (CashOrCard.Models.Promotion promotion in Model.Promotions)
                {
                    <div class="promotion-item">
                        <div class="header">
                            <div class="title">@promotion.PromotionName</div>
                            <div class="status">
                                <span>Status: </span><span>@(DateTime.Now <= promotion.EndDate ? "Active" : "Expired")</span>
                            </div>
                        </div>
                        <div class="description">@promotion.PromotionBody</div>
                        <div id="comment-add-@promotion.PromotionId" class="comment-section"></div>
                        <div id="fakecomment-add-@promotion.PromotionId"  class="comment-section"></div>
                        <div class="footer">
                            <div class="comment">
                                <span class="btn_viewcomment" onclick="viewcomment(@promotion.PromotionId)">View Comments (<label id="comment-count-@promotion.PromotionId">@promotion.PromotionComments.Count</label>)</span>
                                <span class="btn_addcomment" onclick="addcomment(@promotion.PromotionId);">Add Comment</span>
                                <span class="btn-reportfake" onclick="addfakecomment(@promotion.PromotionId);">Report Fake</span>
                            </div>
                            <div class="date">
                                <span>Start Date: @promotion.StartDate.ToString("yyyy-MM-dd")</span>
                                <span>End Date: @promotion.EndDate.ToString("yyyy-MM-dd")</span>
                            </div>
                        </div>
                        <div id="comment-view-@promotion.PromotionId" class="comment-view-section"></div>
                    </div>
                }
            </div>
        </div>
    </div>
    <div class="detail-right">
        @Html.Partial("_QuickSearch")
    </div>
</div>



@Scripts.Render("~/Scripts/Common/advtsite.js")
@Scripts.Render("~/bundles/pikachoose_slideshow")
@Scripts.Render("~/Scripts/colorbox/jquery.colorbox-min.js")
<script>
    $(function () {
        $(".pika-stage>a").colorbox();
    })
</script>

<div style="display: none">
    <div id="loginform" style="height: 300px; width: 450px; border-top: none">
        @Html.Partial("_login_pop")
    </div>
</div>
